package cn.edu.cqie.entity;

import java.math.BigDecimal;
import java.sql.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

/**
 * @author potato 微信用户信息表 openid唯一索引
 */
@Entity
@DynamicInsert
@DynamicUpdate
public class UserInfo {

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private int id;// 用户表主键

	@Column(columnDefinition = "tinyint not null DEFAULT 1")
	private int state; // 0-无效；1-有效

	@Column(nullable = false)
	private String openid; // 用户的标识，对当前小程序唯一

	@Column(length = 64)
	private String nickName; // 昵称

	@Column(length = 256)
	private String headImgUrl;// 头像

	@Column(columnDefinition = "tinyint DEFAULT 0 comment '1-男；2-女；0-未知'")
	private int gender;// 性别

	@Column(columnDefinition = "varchar(256) comment 'MD5 密码'")
	private String password;// 密码，用于提现等操作

	@Column(columnDefinition = "decimal(12,2) DEFAULT 0.00 comment '积分'")
	private BigDecimal integral; // 积分

	@Column(columnDefinition = "decimal(12,2) DEFAULT 0.00 comment '收益'")
	private BigDecimal income; // 实际支付金额

	@Column(columnDefinition = "timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP")
	private Date createTime;

	@Column(columnDefinition = "timestamp NOT NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
	private Date updateTime;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}

	public String getOpenid() {
		return openid;
	}

	public void setOpenid(String openid) {
		this.openid = openid;
	}

	public String getNickName() {
		return nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	public String getHeadImgUrl() {
		return headImgUrl;
	}

	public void setHeadImgUrl(String headImgUrl) {
		this.headImgUrl = headImgUrl;
	}

	public int getGender() {
		return gender;
	}

	public void setGender(int gender) {
		this.gender = gender;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public BigDecimal getIntegral() {
		return integral;
	}

	public void setIntegral(BigDecimal integral) {
		this.integral = integral;
	}

	public BigDecimal getIncome() {
		return income;
	}

	public void setIncome(BigDecimal income) {
		this.income = income;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

}
